/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.ucsur.tp.colegio.form;

import edu.ucsur.tp.colegio.beans.SedeBean;
import edu.ucsur.tp.colegio.beans.ServicioClienteBean;
import edu.ucsur.tp.colegio.beans.TipoBean;
import edu.ucsur.tp.colegio.tempdata.ListaServicioData;
import javax.swing.JOptionPane;

/**
 *
 * @author Administrador
 */
public class Ventana_Servicios extends javax.swing.JInternalFrame {

    /**
     * Creates new form Ventana_Servicios
     */
    public Ventana_Servicios() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        cboTipoServicio = new javax.swing.JComboBox();
        jLabel9 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        cboSedeServicio = new javax.swing.JComboBox();
        jLabel11 = new javax.swing.JLabel();
        txtResponsableServicio = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        txttelefonoServicio = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        txtCodigoServicio = new javax.swing.JTextField();
        txtNombreServicio = new javax.swing.JTextField();
        txtCostoServicio = new javax.swing.JTextField();
        txtEmailServicio = new javax.swing.JTextField();
        btnNuevoServicio = new javax.swing.JButton();
        btnGuardarServicio = new javax.swing.JButton();
        btnModificarServicio = new javax.swing.JButton();
        btneliminarServicio = new javax.swing.JButton();
        btnSalirServicio = new javax.swing.JButton();

        setBackground(new java.awt.Color(0, 204, 204));
        setTitle("REGISTRAR LOS NUEVOS SERVICIOS");

        jPanel1.setBackground(new java.awt.Color(0, 204, 204));
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Ingresar Datos de los Nuevos Servicios"));

        jLabel2.setText("Codigo :");

        jLabel7.setText("Nombre :");

        jLabel8.setText("Tipo :");

        cboTipoServicio.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Imprenta", "Cafeteria", " " }));

        jLabel9.setText("Costo :");

        jLabel12.setText("Sede :");

        cboSedeServicio.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Miraflores", "Arequipa", "San Juan", "San Broja", "Callao", " " }));

        jLabel11.setText("Responsable :");

        jLabel13.setText("Telefono :");

        jLabel10.setText("Email de contacto :");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel9)
                            .addComponent(jLabel11)
                            .addComponent(jLabel12))
                        .addGap(33, 33, 33)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(cboSedeServicio, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(txtResponsableServicio, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel13)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txttelefonoServicio, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(txtCostoServicio, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel7)
                            .addComponent(jLabel8)
                            .addComponent(jLabel2))
                        .addGap(57, 57, 57)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(cboTipoServicio, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtCodigoServicio, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(0, 0, Short.MAX_VALUE))
                            .addComponent(txtNombreServicio)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel10)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(txtEmailServicio)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(txtCodigoServicio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel7)
                    .addComponent(txtNombreServicio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(cboTipoServicio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(txtCostoServicio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12)
                    .addComponent(cboSedeServicio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(txtResponsableServicio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel13)
                    .addComponent(txttelefonoServicio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(7, 7, 7)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(txtEmailServicio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        btnNuevoServicio.setText("NUEVO");
        btnNuevoServicio.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnNuevoServicio.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnNuevoServicio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNuevoServicioActionPerformed(evt);
            }
        });

        btnGuardarServicio.setText("GUARDAR");
        btnGuardarServicio.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnGuardarServicio.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnGuardarServicio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnGuardarServicioActionPerformed(evt);
            }
        });

        btnModificarServicio.setText("MODIFICAR");
        btnModificarServicio.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnModificarServicio.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnModificarServicio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnModificarServicioActionPerformed(evt);
            }
        });

        btneliminarServicio.setText("ELIMINAR");
        btneliminarServicio.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btneliminarServicio.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btneliminarServicio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btneliminarServicioActionPerformed(evt);
            }
        });

        btnSalirServicio.setText("SALIR");
        btnSalirServicio.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnSalirServicio.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnSalirServicio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSalirServicioActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(34, 34, 34)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(btnNuevoServicio, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(btnModificarServicio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btnGuardarServicio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btneliminarServicio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btnSalirServicio, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(19, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(btnNuevoServicio, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnGuardarServicio, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnModificarServicio, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btneliminarServicio, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnSalirServicio, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(23, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnNuevoServicioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNuevoServicioActionPerformed

    }//GEN-LAST:event_btnNuevoServicioActionPerformed

    private void btnGuardarServicioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarServicioActionPerformed

        try{
            
            //--** Instanciando una clase del Servicio (JavaBean)
            ServicioClienteBean servicio = new ServicioClienteBean();
            
            servicio.setCodigoServicio(txtCodigoServicio.getText());
            servicio.setNombre(txtNombreServicio.getText());
            servicio.setTipo(new TipoBean((String) cboTipoServicio.getSelectedItem(), ""));
            servicio.setCosto(Double.parseDouble(txtCostoServicio.getText()));
            servicio.setnombreSede(new SedeBean((String) cboSedeServicio.getSelectedItem(), ""));
            servicio.setResponsable(txtResponsableServicio.getText());
            servicio.setTelefono(txttelefonoServicio.getText());
            servicio.setEmail(txtEmailServicio.getText());
            
            //--** Agregando el servicio instanciado a la data 
      //--** (luego se debe reemplazar por data en base de datos)
            
            ListaServicioData.listaServicio.add(servicio);
            
            
        }catch (Exception ex) {
      ex.printStackTrace();
      JOptionPane.showMessageDialog(null, "Se Grabo Correctamente El Mantenimiento Servicio ");
    }
        
    }//GEN-LAST:event_btnGuardarServicioActionPerformed

    private void btnModificarServicioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnModificarServicioActionPerformed

    }//GEN-LAST:event_btnModificarServicioActionPerformed

    private void btneliminarServicioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btneliminarServicioActionPerformed

    }//GEN-LAST:event_btneliminarServicioActionPerformed

    private void btnSalirServicioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalirServicioActionPerformed
this.dispose();
    }//GEN-LAST:event_btnSalirServicioActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnGuardarServicio;
    private javax.swing.JButton btnModificarServicio;
    private javax.swing.JButton btnNuevoServicio;
    private javax.swing.JButton btnSalirServicio;
    private javax.swing.JButton btneliminarServicio;
    private javax.swing.JComboBox cboSedeServicio;
    private javax.swing.JComboBox cboTipoServicio;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JTextField txtCodigoServicio;
    private javax.swing.JTextField txtCostoServicio;
    private javax.swing.JTextField txtEmailServicio;
    private javax.swing.JTextField txtNombreServicio;
    private javax.swing.JTextField txtResponsableServicio;
    private javax.swing.JTextField txttelefonoServicio;
    // End of variables declaration//GEN-END:variables
}
